<?php
if(get_theme_option('featured_posts') != '') {
?>
<ul id="scroller">
    <?php
    $featured_posts_category = get_theme_option('featured_posts_category');

				if($featured_posts_category != '' && $featured_posts_category != '0') {
                    global $post;

                    $featured_posts = get_posts("numberposts=5&&category=$featured_posts_category");
                    $i = 0;
                    foreach($featured_posts as $post) {
                        setup_postdata($post);
                        if ( version_compare( $wp_version, '2.9', '>=' ) ) {
                            $slide_image_full = get_the_post_thumbnail($post->ID,'large', array());
                            $slide_image_thumbnail = get_the_post_thumbnail($post->ID,'large', array());
                        } else {
                            $get_slide_image = get_post_meta($post->ID, 'featured', true);
                            $slide_image_full = "<li><a href=\"#\"><img width=\"172px\" src=\"$get_slide_image\" alt=\"\" /></a></li>";
                            $slide_image_thumbnail = "<li><a href=\"#\"><img width=\"172px\" src=\"$get_slide_image\" alt=\"\" /></a></li>";
                        }

                        ?>
                        <li><a href="#"><?php echo  $slide_image_full; ?></a></li>
                        <?php }
                } else {
                    for($i = 1; $i <=5; $i++) {
                        ?>
                        <li><a href="#"><img width="172px" src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" alt="" /></a></li>
                        <?php
                    }
                }

    ?>

</ul>
<script type="text/javascript">
    $j=jQuery.noConflict();
    $j('#scroller').simplyScroll({
        auto: true,
        manualMode: 'loop',
        frameRate: 30,
        speed: 1
    });
</script>
<?php } ?>